package com.example.ch09.motionEvent;

// This file is BooleanButton.java

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.Button;

public abstract class BooleanButton extends Button {
    protected boolean myValue() {
        return false;
    }

    public BooleanButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        String myTag = this.getTag().toString();
        Log.v(myTag, "-----------------------------------");
        Log.v(myTag, MotionEventLogUitl.describeEvent(this, event));
        Log.v(myTag,
                "super onTouchEvent() returns " + super.onTouchEvent(event));
        Log.v(myTag, "and I'm returning " + myValue());
        return (myValue());
    }
}
